package com.mine.androidlearn.common.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.hikvision.dbmanage.util.DBHelper;
import com.hikvision.dbmanage.util.TableHelper;

/**
 * Created by hujianghao5 on 2018/4/11.
 */

public class DatabaseHelper extends DBHelper {

    private static final String DBNAME = "baseproject.db";
    private static final int VERSION = 1;
    private static final Class<?>[] CLAZZ = {DBHuInfo.class
//            DBBerthInfo.class,DBCarRecord.class, DBBill.class, DBPic.class, DBFalseReport.class, DBSpot.class, DBSettlementInfo.class, DBCash.class, DBParkNote.class, DBAlarmInfo.class
    };

    public static final String TABLE_HU_INFO="huInfo";                  //测试用表

    public static final String HU_NAME="huName";
    public static final String HU_AGE="huAge";
    public static final String HU_SEX="sex";
    public static final String HU_JOB="job";

    public static final String TABLE_BERTH_INFO = "berthInfo";          // 泊位信息表
    public static final String TABLE_CAR_RECORD = "carRecord";          // 过车记录表
    public static final String TABLE_BILL = "bill";                     // 账单表
    public static final String TABLE_PIC = "pic";                       // 图片表
    public static final String TABLE_FALSE_REPORT = "falseReport";      // 误报信息表
    public static final String TABLE_SPOT = "spot";                     // 停车点
    public static final String TABLE_SETTLEMENT_INFO = "settlementInfo";// 结算信息表
    public static final String TABLE_CASH = "cash";                     // 现金表
    public static final String TABLE_PARK_NOTE = "parkNote";            // 过车数据
    public static final String TABLE_ALARM_INFO = "alarmInfo";          // 报警信息

    public static final String IN_UNID = "inUnid";                      // 唯一过车id
    public static final String CAR_PLATE = "carPlate";                  // 车牌号
    public static final String CAR_TYPE = "carType";                    // 车辆类型
    public static final String PLATE_COLOR = "plateColor";              // 车牌颜色
    public static final String PARK_CODE = "parkCode";                  // 停车点编号
    public static final String PARK_NAME = "parkName";                  // 停车点名称
    public static final String USERNAME = "collectorCode";              // 收费员编号
    public static final String BERTH_CODE = "berthCode";                // 唯一泊位编号
    public static final String BERTH_NUMBER = "berthNumber";            // 停车点的泊位号
    public static final String BERTH_STATE = "berthState";              // 泊位状态
    public static final String IS_ADD_BERTH = "isAddBerth";             // 是否有附加泊位
    public static final String ADD_BERTH_CODE = "addBerthCode";         // 附加泊位编号
    public static final String FEE = "fee";                             // 欠费金额
    public static final String REACH_TIME = "reachTime";                // 入车时间
    public static final String LEAVE_TIME = "leaveTime";                // 出车时间
    public static final String CAPTURE_TIME = "captureTime";            // 拍照时间
    public static final String PARK_TIME = "parkTime";                  // 停车时长
    public static final String PARK_FEE = "parkFee";                    // 停车费用
    public static final String ACCOUNT_AMOUNT = "accountAmount";        // 账户余额
    public static final String NOTICE = "notice";                       // 通知类型
    public static final String PLATE_TYPE = "plateType";                // 车牌类型
    public static final String UPDATE_TIME = "updateTime";              // 抓拍时间
    public static final String PARK_TYPE = "parkType";                  // 停车类型

    public static final String GEO_TIME = "geoTime";                    // 地磁操作时间
    public static final String ACTION = "action";                       // 出入车操作
    public static final String INSERT_TIME = "insertTime";              // 插入时间

    public static final String BILL_UNID = "billUnid";                  // 账单id
    public static final String SHOULD_PAY_MONEY = "shouldPayMoney";     // 应缴金额
    public static final String FREE_REASON = "freeReason";              // 免费原因
    public static final String PLAN_PAY_TIME = "planPayTime";           // 本次结算时间
    public static final String RULE_ID = "ruleId";                      // 收费规则Id

    public static final String PIC_UUID = "picUuid";                    // 图片uuid
    public static final String PIC_URL = "picUrl";                      // 图片url
    public static final String PIC_PATH = "picPath";                    // 图片本地路径
    public static final String PIC_TYPE = "picType";                    // 图片类型

    public static final String CHECK_TIME = "checkTime";                // 操作时间
    public static final String REPORT_REASON = "reportReason";          // 误报原因
    public static final String TERMINAL_CODE = "terminalCode";          // 终端号

    public static final String PIC_TIME = "picTime";                    // 图片时间

    public static final String PAY_PARK_CODE = "payParkCode";           // 付费的停车点
    public static final String PAY_TIME = "payTime";                    // 结算时间
    public static final String PAY_MONEY = "payMoney";                  // 实收金额
    public static final String PAY_TYPE = "payType";                    // 支付方式

    public static final String CASH = "cash";                           // 现金

    public static final String ALARM_TIME = "alarmTime";                // 报警时间
    public static final String ALARM_ID = "alarmId";                    // 报警Id
    public static final String TYPE = "type";                           // 业务类型

    public static final String LAST_PAY_TIME = "lastPayTime";           // 上次支付时间
    public static final String LAST_SETTLE_TIME = "lastSettleTime";     // 上次结算时间
    public static final String PAID_TOTAL_MONEY = "paidTotalMoney";     // 已支付总金额
    public static final String PHOTO_TIME = "photoTime";                // 拍照时间

    public DatabaseHelper(Context context) {
        super(context, DBNAME, null, VERSION, CLAZZ);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        super.onUpgrade(db, oldVersion, newVersion);
    }

    @Override
    public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        TableHelper.dropTablesByClasses(db, CLAZZ);
        onCreate(db);
    }
}
